package com.imooc.reader.task;

import com.imooc.reader.mapper.BookMapper;

import org.springframework.scheduling.annotation.Scheduled;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
public class ComputeTask {

    @Resource
    private BookMapper bookMapper;

    /*每分钟执行一次，计算总的平均分*/
//    @Scheduled(cron = "0/10 * * * * ?")
    public void updateEvaluation() {
        System.out.println("bookMapper是否为null: " + (bookMapper == null));
        bookMapper.updateEvaluation();
        System.out.println("定时任务执行。。。");
    }
}
